package com.gonsin.gmessage.logic.model;

import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
@ApiModel("消息结构")
public class ReceiveMessageModel implements Cloneable{

    private String head = "gonsin";

    /**
     * 发送的域
     */
    private transient String zoom;

    private String firstCmd;

    private String subCmd;

    private String payload;

    private ReceiveMessageModel(){}

    public ReceiveMessageModel firstCmd(String firstCmd){
        this.firstCmd = firstCmd;
        return this;
    }

    public ReceiveMessageModel subCmd(String subcmd){
        this.subCmd = subcmd;
        return this;
    }

    public ReceiveMessageModel zoom(String zoom){
        this.zoom = zoom;
        return this;
    }

    public ReceiveMessageModel payload(String payload){
        this.payload = payload;
        return this;
    }

    public static ReceiveMessageModel create(String firstCmd, String subCmd){
        ReceiveMessageModel mqttMessage = new ReceiveMessageModel();
        mqttMessage.setFirstCmd(firstCmd);
        mqttMessage.setSubCmd(subCmd);
        return mqttMessage;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
